# Maintainer: damir <damir@archlinux.org>

pkgbase=libxml++
pkgname=('libxml++' 'libxml++-docs')
pkgver=3.0.1+4+g2af973f
pkgrel=2
arch=('x86_64')
license=('LGPL')
url="http://libxmlplusplus.sourceforge.net/"
makedepends=('pkgconfig' 'glibmm-docs' 'libxml2' 'glibmm' git mm-common)
options=('!emptydirs')
_commit=2af973ff59b2151e0783bbe4155816ce88d0c8b0  # libxml++-3.0
source=("git+https://git.gnome.org/browse/libxml++#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgbase
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgbase
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd "${srcdir}/$pkgbase"
  ./configure --prefix=/usr

  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd "${srcdir}/$pkgbase"
  make check
}

package_libxml++() {
  pkgdesc="C++ bindings to libxml2"
  depends=('libxml2' 'glibmm')

  cd "${srcdir}/$pkgbase"
  make DESTDIR="${pkgdir}" install doc_subdirs=
}

package_libxml++-docs() {
  pkgdesc="Developer documentation for libxml++"
  depends=('glibmm-docs')
  cd "${srcdir}/$pkgbase"
  make DESTDIR="${pkgdir}" -C docs install
}
